{include file=header.html}
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
<script type="text/javascript">
$(function(){
     $('#factory_form').validate({
        onkeyup : false,
		onfocusout : false,
        rules : {
			factory_name: {
				required: true,
				remote: 'index.php?app=factory&act=check_factory&factory_name=' + $('#factory_name').val(){if $smarty.get.act eq 'edit'} + '&factory_id={$smarty.get.fid}'{/if}
			},
			type_id: {
				min: 1
			}
		},
		messages : {
			factory_name: {
				required: '{$lang.factory_name_not_empty}',
				remote: '{$lang.factory_name_is_exist}'
			},
			type_id: {
				min: '{$lang.factory_type_select_pls}'
			}
		}
	 });
});
</script>
<style>
label.error {margin-left:2em; color:#FF0000;}
.tab-frame{width:900px;}
</style>
<body>
<div class="sub-body">
<div class="tab-frame">
<div class="tab-title-1">
<!--{if $smarty.get.act eq 'add'}--><span>{$lang.add_new_factory}</span><!--{else}--><span>{$lang.edit_factory}</span><!--{/if}-->
</div>
<form action="{url app=factory&act=$smarty.get.act}{if $smarty.get.fid}&amp;fid={$smarty.get.fid}{/if}" method="post" id="factory_form">
<table width="100%" cellspacing="0" cellpadding="0" class="tab-display">
	<tr>
		<th width="100" align="right">{$lang.factory_name}：</th>
		<td align="left"><input type="text" name="factory_name" id="factory_name" value="{$factory.factory_name}" class="input-7" /></td>
	</tr>
	<tr>
		<th align="right">{$lang.factory_type}：</th>
		<td align="left">
			<select name="type_id">
				<option value="0">{$lang.select_pls}</option>
				<!--{foreach from=$types item=type}-->
				<option value="{$type.type_id}" {if $type.type_id == $factory.type_id} selected{/if}>{$type.type_name}</option>
				<!--{/foreach}-->
			</select><a href="{url app=factory&act=type}" style="margin-left:2em;">{$lang.type_manage}</a>
		</td>
	</tr>
	<tr>
		<th align="right">{$lang.address}：</th>
		<td align="left"><input type="text" name="address" value="{$factory.address}" class="input-7" /></td>
	</tr>
	<tr>
		<th align="right">{$lang.contact}：</th>
		<td align="left"><input type="text" name="contact" value="{$factory.contact}" class="input-1" /></td>
	</tr>
	<tr>
		<th align="right">{$lang.qc}：</th>
		<td align="left">
		   <!--{foreach from=$member_list item=member_info}-->
		          <input type="checkbox" name="qc[]" value="{$member_info.user_id}" {if in_array($member_info.user_id,$qf_list)}checked{/if}  class="input-1" />{$member_info[user_name]}
		       
		   <!-- {/foreach} -->
		</td>
	</tr>
	<tr>
		<th align="right">{$lang.tel}：</th>
		<td align="left"><input type="text" name="tel" value="{$factory.tel}" class="input-1" /></td>
	</tr>
	<tr>
		<th align="right">{$lang.fax}：</th>
		<td align="left"><input type="text" name="fax" value="{$factory.fax}" class="input-1" /></td>
	</tr>
	<tr>
		<th align="right">{$lang.email}：</th>
		<td align="left"><input type="text" name="email" value="{$factory.email}" class="input-1" /></td>
	</tr>
	<tr>
		<th align="right">{$lang.description}：</th>
		<td align="left"><textarea name="description" rows="6" class="input-7">{$factory.description}</textarea></td>
	</tr>
	<tr>
		<th align="right">{$lang.if_show}：</th>
		<td align="left"><label><input type="radio" name="if_show" value="1" {if $factory.if_show == 1}checked="checked"{/if} />{$lang.yes}</label>&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="if_show" value="0" {if $factory.if_show == 0}checked="checked"{/if} />{$lang.no}</label></td>
	</tr>
	<tr>
		<td colspan="2" align="center"><input type="submit" value="{$lang.submit}" class="btn-2" /></td>
	</tr>
</table>
</form>
<script language="javascript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
</div>
</div>
</body>
</html>